import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';

@Entity('jobs')
export class Jobs {
  @PrimaryGeneratedColumn({
    name: 'id',
    type: 'int',
  })
  id: number;

  @Index()
  @Column({
    name: 'queue',
    type: 'varchar',
    length: 255,
    nullable: false,
  })
  queue: string;

  @Column({
    name: 'payload',
    type: 'longtext',
    nullable: false,
  })
  payload: string;

  @Column({
    name: 'attempts',
    type: 'tinyint',
    unsigned: true,
    nullable: false,
  })
  attempts: number;

  @Column({
    name: 'reserve_time',
    type: 'int',
    unsigned: true,
    nullable: true,
  })
  reserveTime: number;

  @Column({
    name: 'available_time',
    type: 'int',
    unsigned: true,
    nullable: false,
  })
  availableTime: number;

  @Column({
    name: 'create_time',
    type: 'int',
    unsigned: true,
    nullable: false,
  })
  createTime: number;
}